//
//  MenuListManager.m
//  TopMenu
//
//  Created by liwei on 2017/6/6.
//  Copyright © 2017年 liwei. All rights reserved.
//

#import "MenuListManager.h"

@interface MenuListManager ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic,strong) NSMutableArray *dataSource;

//标识是否已经绑定过list
@property (nonatomic,assign) BOOL hasSetupListTab;

@end

@implementation MenuListManager


- (void)setMenulistTab:(UITableView *)menulistTab {

    if (self.hasSetupListTab) {
        return;
    }
    self.hasSetupListTab = YES;
    
    _menulistTab = menulistTab;
    
    _menulistTab.dataSource = self;
    _menulistTab.delegate = self;
    
    [_menulistTab registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
}

- (void)loadListData {

    [self.menulistTab reloadData];
    
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return 20;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
    cell.textLabel.text = [NSString stringWithFormat:@"%@ ====== 第%ld行",self.menuName,indexPath.row];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.textLabel.textColor = [UIColor darkGrayColor];
    cell.backgroundColor = [UIColor clearColor];
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {

    return 40;
}

@end
